<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <title>个人中心</title>
        <link rel="stylesheet" href="<c:url value="/static/wx/css/style.css"/>" />
        <script type="text/javascript" src="<c:url value="/static/wx/js/lib/rem.js"/>" ></script>
    </head>

    <body class="befeff4">
        <div id="wrap">
            <div class="header_mine_s mt10" id="goAccountSetting">
                <div class="common header_wrap">
                    <div>
                        <c:choose>
                            <c:when test="${userVo.userImg != '' && userVo.userImg != null }">
                                <img id="header_img" src="${userVo.userImg}" />
                            </c:when>
                            <c:otherwise>
                                <img id="header_img" src="<c:url value="/static/wx/img/people.png"/>" />
                            </c:otherwise>
                        </c:choose>
                    </div>
                    <div class="header_text">
                        <div class="header_name tl">
                            <c:choose>
								<c:when test="${userVo.cardName != '' && userVo.cardName != null }">
								    ${userVo.cardName}
								</c:when>
								<c:otherwise>
								    ${userVo.contacts }
								</c:otherwise>
							</c:choose>
                        </div>
                        <div class="header_tel tl">${userVo.telephone }</div>
                    </div>
                    <div class="header_right">
                        <img  src="<c:url value="/static/wx/img/address_icon.png"/>" />
                        <!-- <span class="ifAuthenticate" id="city"></span> -->
                        <span class="ifAuthenticate" >地址</span>
                        <i class="right_icon"></i>
                    </div>
                </div>
            </div>

            <div class="section_list mt10">
                <a href="<c:url value="/wx/toMyAccount.do"/>?userId=${userVo.bId}">
	                <div class="common relative boder-bottom clearfix">
	                    <div class="section_list_left fl">
	                        <img class="left_img" src="<c:url value="/static/wx/img/price_icon.png"/>" />
	                        <span class="text">我的回收金</span>
	                    </div>
	                    <div class="section_list_right fr">
	                        <span class="c666"></span>
	                        <i class="right_icon"></i>
	                    </div>
	                </div>
                </a>
            </div>

            <div class="section_list">
                <a href="<c:url value="/wx/toStatement.do"/>?userId=${userVo.bId}">
	                <div class="common relative boder-bottom clearfix">
	                    <div class="section_list_left fl">
	                        <img class="left_img" src="<c:url value="/static/wx/img/checked_icon.png"/>" />
	                        <span class="text">对账单</span>
	                    </div>
	                    <div class="section_list_right fr">
	                        <span class="c666"></span>
	                        <i class="right_icon"></i>
	                    </div>
	                </div>
	            </a>
            </div>
            
            <div class="section_list">
                <a href="<c:url value="/wx/toMyBank.do"/>?id=${userVo.bId}">
                    <div class="common relative boder-bottom clearfix">
                        <div class="section_list_left fl">
                            <img class="left_img" src="<c:url value="/static/wx/img/bank_img.png"/>" />
                            <span class="text">我的银行卡</span>
                        </div>
                        <div class="section_list_right fr">
                            <span class="c666"></span>
                            <i class="right_icon"></i>
                        </div>
                    </div>
                </a>
            </div>
            
            <div class="section_list">
                <a href="<c:url value="/wx/toSecurity.do"/>?id=${userVo.bId}">
                    <div class="common relative boder-bottom clearfix">
                        <div class="section_list_left fl">
                            <img class="left_img" src="<c:url value="/static/wx/img/security_icon.png"/>" />
                            <span class="text">安全设置</span>
                        </div>
                        <div class="section_list_right fr">
                            <span class="c666"></span>
                            <i class="right_icon"></i>
                        </div>
                    </div>
                </a>
            </div>

            <div class="section_list">
                <a href="<c:url value="/wx/toMyCode.do"/>?userId=${userVo.bId}">
	                <div class="common relative boder-bottom clearfix">
	                    <div class="section_list_left fl">
	                        <img class="left_img" src="<c:url value="/static/wx/img/code_icon.png"/>" />
	                        <span class="text">我的二维码</span>
	                    </div>
	                    <div class="section_list_right fr">
	                        <span class="c666"></span>
	                        <i class="right_icon"></i>
	                    </div>
	                </div>
	            </a>
            </div>

            <div class="section_list mt10">
	            <a href="<c:url value="/wx/toSuggestion.do"/>?userId=${userVo.bId}">
	                <div class="common relative boder-bottom clearfix">
	                    <div class="section_list_left fl">
	                        <img class="left_img" src="<c:url value="/static/wx/img/suggestion_icon.png"/>" />
	                        <span class="text">意见反馈</span>
	                    </div>
	                    
	                    <div class="section_list_right fr">
	                        <span class="c666"></span>
	                        <i class="right_icon"></i>
	                    </div>
	                </div>
	             </a>
            </div>

            <div class="section_list">
                <div class="common relative boder-bottom clearfix">
                    <div class="section_list_left fl">
                        <img class="left_img" src="<c:url value="/static/wx/img/customer_service_icon.png"/>" />
                        <span class="text">客服电话</span>
                    </div>
                    <div class="fr">
                        <span class="c666">0512-67229422</span>
                    </div>
                </div>
            </div>

            <div class="section_list">
                <div class="common relative boder-bottom clearfix">
                    <div class="section_list_left fl">
                        <img class="left_img" src="<c:url value="/static/wx/img/share_icon.png"/>" />
                        <span class="text">推荐给微信好友</span>
                    </div>
                </div>
            </div>
        </div>
        
        <div id="container" class="none"></div>
        <div class="info none" >
            <!-- <p>在初始化地图时，如果center属性缺省，地图默认定位到用户所在城市的中心</p><hr> -->
            <p id='adcode'></p>
        </div>
        
        <input type="hidden" id="userId" value="${userVo.bId }"/>
        <script type="text/javascript" src="<c:url value="/static/wx/js/lib/jquery-3.3.1.min.js"/>"></script>
        <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.10&key=30ab112c81c0a478bf33c58ae1461447&plugin=AMap.Geocoder"></script>
        <script type="text/javascript">
            //初始化地图时，若center属性缺省，地图默认定位到用户所在城市的中心
            var map = new AMap.Map('container', {
                resizeEnable: true
            });
            document.getElementById('adcode').innerHTML='当前城市adcode：'+map.getAdcode()+'<br>'+
            '当前中心点：'+map.getCenter();
            var centerCode = map.getCenter().lng + ',' + map.getCenter().lat ;
            regeoCode();
            
            var geocoder,marker;
            var province,city,district,detailAddress,addressThreee;
            
            function regeoCode() {
                if(!geocoder){
                    geocoder = new AMap.Geocoder({
                        city: "", //城市设为北京，默认：“全国”
                        radius: 1000 //范围，默认：500
                    });
                }
                var lnglat  = centerCode.split(',');
                 if(!marker){
                    marker = new AMap.Marker();
                    map.add(marker);
                }
                marker.setPosition(lnglat);
                
                geocoder.getAddress(lnglat, function(status, result) {
                    if (status === 'complete'&&result.regeocode) {
                        var address = result.regeocode.formattedAddress;
                        province = result.regeocode.addressComponent.province;
                        city = result.regeocode.addressComponent.city;
                        district = result.regeocode.addressComponent.district;
                        detailAddress = result.regeocode.addressComponent.township + result.regeocode.addressComponent.neighborhood;
                        addressThreee = province + city + district;
                       // document.getElementById('city').innerText = city;
                    }else{
                    	console.log(JSON.stringify(result));
                    }
                });
            }
            
            var userId = $("#userId").val();
            $(document).ready(function(){
                $("#goAccountSetting").on("click",function(){
                    window.location.href="<c:url value="/wx/toAccountSetting.do"/>?id="+userId+"&addressThreee=" + addressThreee + "&detailAddress=" +  detailAddress;
                })
            })
          
        </script>
    </body>
</html>